﻿//==================================================================
// Copyright (C) 2011 深圳市中旭企业管理股份有限公司
// 文件名: V_HF_CompleteWorkTask.cs
// 作 者：代码自动生成
// 日 期：2012-2-21 15:28:53
// 描 述：
// 版 本：1.00
// 修改历史纪录
// 版 本  修改时间      修改人            修改内容
// 1.00             
//==================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using System.Text;
using Csla;
using lite;
using Csla.Validation;
using Csla.Data;
using System.Data.SqlClient;
using ZX.DAL;
using OpenExpressApp.ORM;

namespace ZX.CRM.Library
{
	/// <summary>
    /// 
    /// </summary>
	[Serializable]
    [Table(Name="V_HF_CompleteWorkTask")]
    [ZX.DBModule.Table("V_HF_CompleteWorkTask","WorkFlowNo")]
	public class V_HF_CompleteWorkTask: ZX.DBModule.BaseEntity
	{
        #region Business Methods 业务方法
        /// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > WorkFlowNoProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("WorkFlowNo"));
        [DataObjectField(true, true)]
        [Column, PK]
        public string WorkFlowNo
        {
            get { return GetProperty(WorkFlowNoProperty); }
            set { SetProperty(WorkFlowNoProperty, value); }
        }
        private static PropertyInfo<string> WorkTaskTitleProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask), new PropertyInfo<string>("WorkTaskTitle"));
        [Column]
        public string WorkTaskTitle
        {
            get { return GetProperty(WorkTaskTitleProperty); }
            set { SetProperty(WorkTaskTitleProperty, value); }
        } 
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > PriorityProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("Priority"));
        [Column]
        public string Priority
        {
            get { return GetProperty(PriorityProperty); }
            set { SetProperty(PriorityProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< DateTime > taskStartTimeProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< DateTime >("taskStartTime"));
        [Column]
        public DateTime taskStartTime
        {
            get { return GetProperty(taskStartTimeProperty); }
            set { SetProperty(taskStartTimeProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > TaskInstanceCaptionProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("TaskInstanceCaption"));
        [Column]
        public string TaskInstanceCaption
        {
            get { return GetProperty(TaskInstanceCaptionProperty); }
            set { SetProperty(TaskInstanceCaptionProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > FlowInstanceCaptionProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("FlowInstanceCaption"));
        [Column]
        public string FlowInstanceCaption
        {
            get { return GetProperty(FlowInstanceCaptionProperty); }
            set { SetProperty(FlowInstanceCaptionProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > OperContentProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("OperContent"));
        [Column]
        public string OperContent
        {
            get { return GetProperty(OperContentProperty); }
            set { SetProperty(OperContentProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > FlowCaptionProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("FlowCaption"));
        [Column]
        public string FlowCaption
        {
            get { return GetProperty(FlowCaptionProperty); }
            set { SetProperty(FlowCaptionProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > TaskCaptionProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("TaskCaption"));
        [Column]
        public string TaskCaption
        {
            get { return GetProperty(TaskCaptionProperty); }
            set { SetProperty(TaskCaptionProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > UserIdProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("UserId"));
        [Column]
        public string UserId
        {
            get { return GetProperty(UserIdProperty); }
            set { SetProperty(UserIdProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > OperatorInstanceIdProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("OperatorInstanceId"));
        [Column]
        public string OperatorInstanceId
        {
            get { return GetProperty(OperatorInstanceIdProperty); }
            set { SetProperty(OperatorInstanceIdProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > WorkFlowIdProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("WorkFlowId"));
        [Column]
        public string WorkFlowId
        {
            get { return GetProperty(WorkFlowIdProperty); }
            set { SetProperty(WorkFlowIdProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > WorkTaskIdProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("WorkTaskId"));
        [Column]
        public string WorkTaskId
        {
            get { return GetProperty(WorkTaskIdProperty); }
            set { SetProperty(WorkTaskIdProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > WorkFlowInstanceIdProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("WorkFlowInstanceId"));
        [Column]
        public string WorkFlowInstanceId
        {
            get { return GetProperty(WorkFlowInstanceIdProperty); }
            set { SetProperty(WorkFlowInstanceIdProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > WorkTaskInstanceIdProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("WorkTaskInstanceId"));
        [Column]
        public string WorkTaskInstanceId
        {
            get { return GetProperty(WorkTaskInstanceIdProperty); }
            set { SetProperty(WorkTaskInstanceIdProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< int > OperTypeProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< int >("OperType"));
        [Column]
        public int OperType
        {
            get { return GetProperty(OperTypeProperty); }
            set { SetProperty(OperTypeProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > TaskTypeIdProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("TaskTypeId"));
        [Column]
        public string TaskTypeId
        {
            get { return GetProperty(TaskTypeIdProperty); }
            set { SetProperty(TaskTypeIdProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< bool > IsSubWorkFlowProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< bool >("IsSubWorkFlow"));
        [Column]
        public bool IsSubWorkFlow
        {
            get { return GetProperty(IsSubWorkFlowProperty); }
            set { SetProperty(IsSubWorkFlowProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > MainWorkTaskIdProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("MainWorkTaskId"));
        [Column]
        public string MainWorkTaskId
        {
            get { return GetProperty(MainWorkTaskIdProperty); }
            set { SetProperty(MainWorkTaskIdProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > MainWorkFlowInstanceIdProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("MainWorkFlowInstanceId"));
        [Column]
        public string MainWorkFlowInstanceId
        {
            get { return GetProperty(MainWorkFlowInstanceIdProperty); }
            set { SetProperty(MainWorkFlowInstanceIdProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > OperatedDesProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("OperatedDes"));
        [Column]
        public string OperatedDes
        {
            get { return GetProperty(OperatedDesProperty); }
            set { SetProperty(OperatedDesProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< DateTime > OperDateTimeProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< DateTime >("OperDateTime"));
        [Column]
        public DateTime OperDateTime
        {
            get { return GetProperty(OperDateTimeProperty); }
            set { SetProperty(OperDateTimeProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< DateTime > taskEndTimeProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< DateTime >("taskEndTime"));
        [Column]
        public DateTime taskEndTime
        {
            get { return GetProperty(taskEndTimeProperty); }
            set { SetProperty(taskEndTimeProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< DateTime > flowStartTimeProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< DateTime >("flowStartTime"));
        [Column]
        public DateTime flowStartTime
        {
            get { return GetProperty(flowStartTimeProperty); }
            set { SetProperty(flowStartTimeProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< DateTime > flowEndTimeProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< DateTime >("flowEndTime"));
        [Column]
        public DateTime flowEndTime
        {
            get { return GetProperty(flowEndTimeProperty); }
            set { SetProperty(flowEndTimeProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > pOperatedDesProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("pOperatedDes"));
        [Column]
        public string pOperatedDes
        {
            get { return GetProperty(pOperatedDesProperty); }
            set { SetProperty(pOperatedDesProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > DescriptionProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("Description"));
        [Column]
        public string Description
        {
            get { return GetProperty(DescriptionProperty); }
            set { SetProperty(DescriptionProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > OperStatusProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("OperStatus"));
        [Column]
        public string OperStatus
        {
            get { return GetProperty(OperStatusProperty); }
            set { SetProperty(OperStatusProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > StatusProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("Status"));
        [Column]
        public string Status
        {
            get { return GetProperty(StatusProperty); }
            set { SetProperty(StatusProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > flStatusProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("flStatus"));
        [Column]
        public string flStatus
        {
            get { return GetProperty(flStatusProperty); }
            set { SetProperty(flStatusProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > PreviousTaskInstanceIdProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("PreviousTaskInstanceId"));
        [Column]
        public string PreviousTaskInstanceId
        {
            get { return GetProperty(PreviousTaskInstanceIdProperty); }
            set { SetProperty(PreviousTaskInstanceIdProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > OperContentTextProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("OperContentText"));
        [Column]
        public string OperContentText
        {
            get { return GetProperty(OperContentTextProperty); }
            set { SetProperty(OperContentTextProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > taskInsTypeProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("taskInsType"));
        [Column]
        public string taskInsType
        {
            get { return GetProperty(taskInsTypeProperty); }
            set { SetProperty(taskInsTypeProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > SuccessMsgProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("SuccessMsg"));
        [Column]
        public string SuccessMsg
        {
            get { return GetProperty(SuccessMsgProperty); }
            set { SetProperty(SuccessMsgProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > ChangeOperatorProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("ChangeOperator"));
        [Column]
        public string ChangeOperator
        {
            get { return GetProperty(ChangeOperatorProperty); }
            set { SetProperty(ChangeOperatorProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > TaskInsDescriptionProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("TaskInsDescription"));
        [Column]
        public string TaskInsDescription
        {
            get { return GetProperty(TaskInsDescriptionProperty); }
            set { SetProperty(TaskInsDescriptionProperty, value); }
        }
		/// <summary>
        /// 
        /// </summary>
        private static PropertyInfo< string > NowTaskIdProperty = RegisterProperty(typeof(V_HF_CompleteWorkTask),new PropertyInfo< string >("NowTaskId"));
        [Column]
        public string NowTaskId
        {
            get { return GetProperty(NowTaskIdProperty); }
            set { SetProperty(NowTaskIdProperty, value); }
        }
        #endregion
        
        #region Validation Rules 验证规则
        //将验证规则与业务对象的属性联系在一起
        protected override void AddBusinessRules()
        {
            //AddRule的第一个参数是委托变量，也就是说是方法的变量
            ValidationRules.AddRule(CommonRules.StringRequired, "Priority");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Priority", 1));
            ValidationRules.AddRule(CommonRules.StringRequired, "TaskInstanceCaption");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("TaskInstanceCaption", 128));
            ValidationRules.AddRule(CommonRules.StringRequired, "FlowInstanceCaption");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("FlowInstanceCaption", 128));
            ValidationRules.AddRule(CommonRules.StringRequired, "OperContent");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("OperContent", 256));
            ValidationRules.AddRule(CommonRules.StringRequired, "FlowCaption");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("FlowCaption", 128));
            ValidationRules.AddRule(CommonRules.StringRequired, "TaskCaption");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("TaskCaption", 128));
            ValidationRules.AddRule(CommonRules.StringRequired, "UserId");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserId", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "OperatorInstanceId");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("OperatorInstanceId", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "WorkFlowId");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("WorkFlowId", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "WorkTaskId");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("WorkTaskId", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "WorkFlowInstanceId");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("WorkFlowInstanceId", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "WorkTaskInstanceId");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("WorkTaskInstanceId", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "TaskTypeId");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("TaskTypeId", 1));
            ValidationRules.AddRule(CommonRules.StringRequired, "MainWorkTaskId");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("MainWorkTaskId", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "MainWorkFlowInstanceId");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("MainWorkFlowInstanceId", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "OperatedDes");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("OperatedDes", 256));
            ValidationRules.AddRule(CommonRules.StringRequired, "pOperatedDes");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("pOperatedDes", 256));
            ValidationRules.AddRule(CommonRules.StringRequired, "Description");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Description", 512));
            ValidationRules.AddRule(CommonRules.StringRequired, "OperStatus");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("OperStatus", 1));
            ValidationRules.AddRule(CommonRules.StringRequired, "Status");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("Status", 1));
            ValidationRules.AddRule(CommonRules.StringRequired, "flStatus");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("flStatus", 1));
            ValidationRules.AddRule(CommonRules.StringRequired, "PreviousTaskInstanceId");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("PreviousTaskInstanceId", 50));
            ValidationRules.AddRule(CommonRules.StringRequired, "OperContentText");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("OperContentText", 256));
            ValidationRules.AddRule(CommonRules.StringRequired, "taskInsType");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("taskInsType", 1));
            ValidationRules.AddRule(CommonRules.StringRequired, "SuccessMsg");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("SuccessMsg", 512));
            ValidationRules.AddRule(CommonRules.StringRequired, "ChangeOperator");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("ChangeOperator", 256));
            ValidationRules.AddRule(CommonRules.StringRequired, "TaskInsDescription");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("TaskInsDescription", 256));
            ValidationRules.AddRule(CommonRules.StringRequired, "NowTaskId");
            ValidationRules.AddRule(CommonRules.StringMaxLength, new Csla.Validation.CommonRules.MaxLengthRuleArgs("NowTaskId", 50));
            //base.AddBusinessRules();
        }
        #endregion
        
        #region Factory Methods 工厂方法

        public V_HF_CompleteWorkTask(){}

        public static V_HF_CompleteWorkTask New()
        {
            return DataPortal.Create< V_HF_CompleteWorkTask>();
        }
        public static V_HF_CompleteWorkTask Get(string WorkFlowNo)
        {
            return DataPortal.Fetch< V_HF_CompleteWorkTask>(new SingleLazyCriteria< V_HF_CompleteWorkTask, string>(WorkFlowNo, false));
        }
        public static void Delete(string WorkFlowNo )
        {
            DataPortal.Delete(WorkFlowNo);
        }
        
        #endregion
        
        #region Data Access 数据访问
        //由于DataPortal_create中没有对数据库的访问，所有标记了Runlocal特性，使得该方法只需在本地运行即可
        //如果代码中有访问数据库的方法，那么就不要用这个特性，使数据门户可以根据情况将此方法的运行选择在应用服务器还是本地
        [RunLocal()]
        protected override void DataPortal_Create()
        {
            //在此调用CheckRules对所有的属性进行验证规则的检查，这样检查只运行一次。
            ValidationRules.CheckRules();
        }


        //可以看到此方法没有标记任何特性
        //此方法要访问数据库所以不能标记本地，由于她没有任何数据库更新操作所以也无需事务性的保护
        //此方法调用结束后会隐含的调用MarkOld（）方法
        private void DataPortal_Fetch(string WorkFlowNo)
        {
            //通过连接字符串建立SQL连接对象，Using符号代表，范围释放的意思，SqlConnection对象会在此范围后被释放掉
             using (var ctx = ConnectionManager<SqlConnection>.GetManager(ConnectionStringNames))
            {
                IDb db = DbFactory.Instance.GetDb(ctx.Connection);
                IQuery q = db.Query();
                q.Constrain("WorkFlowNo").Equal(WorkFlowNo);
                
                var data = db.Select< V_HF_CompleteWorkTask>(q)[0];
                LoadProperty(WorkFlowNoProperty, data.WorkFlowNo);
                LoadProperty(PriorityProperty, data.Priority);
                LoadProperty(WorkTaskTitleProperty, data.WorkTaskTitle);
                LoadProperty(taskStartTimeProperty, data.taskStartTime);
                LoadProperty(TaskInstanceCaptionProperty, data.TaskInstanceCaption);
                LoadProperty(FlowInstanceCaptionProperty, data.FlowInstanceCaption);
                LoadProperty(OperContentProperty, data.OperContent);
                LoadProperty(FlowCaptionProperty, data.FlowCaption);
                LoadProperty(TaskCaptionProperty, data.TaskCaption);
                LoadProperty(UserIdProperty, data.UserId);
                LoadProperty(OperatorInstanceIdProperty, data.OperatorInstanceId);
                LoadProperty(WorkFlowIdProperty, data.WorkFlowId);
                LoadProperty(WorkTaskIdProperty, data.WorkTaskId);
                LoadProperty(WorkFlowInstanceIdProperty, data.WorkFlowInstanceId);
                LoadProperty(WorkTaskInstanceIdProperty, data.WorkTaskInstanceId);
                LoadProperty(OperTypeProperty, data.OperType);
                LoadProperty(TaskTypeIdProperty, data.TaskTypeId);
                LoadProperty(IsSubWorkFlowProperty, data.IsSubWorkFlow);
                LoadProperty(MainWorkTaskIdProperty, data.MainWorkTaskId);
                LoadProperty(MainWorkFlowInstanceIdProperty, data.MainWorkFlowInstanceId);
                LoadProperty(OperatedDesProperty, data.OperatedDes);
                LoadProperty(OperDateTimeProperty, data.OperDateTime);
                LoadProperty(taskEndTimeProperty, data.taskEndTime);
                LoadProperty(flowStartTimeProperty, data.flowStartTime);
                LoadProperty(flowEndTimeProperty, data.flowEndTime);
                LoadProperty(pOperatedDesProperty, data.pOperatedDes);
                LoadProperty(DescriptionProperty, data.Description);
                LoadProperty(OperStatusProperty, data.OperStatus);
                LoadProperty(StatusProperty, data.Status);
                LoadProperty(flStatusProperty, data.flStatus);
                LoadProperty(PreviousTaskInstanceIdProperty, data.PreviousTaskInstanceId);
                LoadProperty(OperContentTextProperty, data.OperContentText);
                LoadProperty(taskInsTypeProperty, data.taskInsType);
                LoadProperty(SuccessMsgProperty, data.SuccessMsg);
                LoadProperty(ChangeOperatorProperty, data.ChangeOperator);
                LoadProperty(TaskInsDescriptionProperty, data.TaskInsDescription);
                LoadProperty(NowTaskIdProperty, data.NowTaskId);
            }
        }

        [Transactional(TransactionalTypes.TransactionScope)]
        protected override void DataPortal_DeleteSelf()
        {
            //依然是调用下面的方法删除的，只是他此时可以获得自己的Id
            DataPortal_Delete(WorkFlowNoProperty);
        }
        #endregion
	}
}

